<template>
  <div class="box">
    <div class="tou">
      <span @click="fn()">&lt;</span>
      <span>我的优惠券</span>
    </div>
    <div class="xia">
      <div class="sg">
        <span @click="fun('Shuiguo')">好吃水果</span>
        <span @click="fun('Shicai')">精选食材</span>
      </div>
    </div>
    <div class="dh">
      <input type="text" placeholder="请输入兑换码" />
      <span>兑换</span>
    </div>
    <keep-alive>
      <component :is="username"></component>
    </keep-alive>
  </div>
</template>

<script>
import Shuiguo from "./xuanze/shuiguo.vue";
import Shicai from "./xuanze/shicai.vue";
export default {
  data() {
    return {
      username: "Shuiguo",
    };
  },
  
  methods: {
    fun(data) {
      this.username = data;
    },
    fn(){
      this.$router.go("-1")
    
    },
  },
  components: {
    Shuiguo,
    Shicai,
  },
};
</script>

<style>
.tou {
  height: 0.4rem;
  line-height: 0.4rem;
  font-size: 0.18rem;
  background: white;
  border-bottom: 1px solid rgb(200, 200, 200);
}
.tou span:nth-child(1) {
  margin-left: 0.1rem;
}
.tou span:nth-child(2) {
  margin-left: 1.2rem;
}
.xia {
  text-align: center;
}
.sg {
  background: white;
  height: 0.4rem;
  line-height: 0.4rem;
  display: flex;
  font-size: 0.18rem;
}
.sg span:nth-child(1) {
  flex: 1;
}
.sg span:nth-child(2) {
  flex: 1;
}
.dh {
  padding-top: .05rem;
  height: 0.4rem;
  background: white;
}
input {
  margin-left: 0.2rem;
  height: 0.3rem;
  width: 2.8rem;
  border: none;
  background: rgb(220, 220, 220);
  border-radius: 0.1rem;
  text-indent: 0.2rem;
}
.dh span {
  font-size: 0.18rem;
  margin-left: 0.15rem;
}
</style>